<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>普通会员列表</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/common.js"></script>
<script src="../js/artDialog.js?skin=gray"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
<script language="javascript" type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

	function searchMember(){

		$("#customer_list_form").submit();
	}

	/******修改状态 *****/
	function changeState(id,status){
		if(status == '3'){
			if (window.confirm("确认删除此会员？")) {
				var curPage = $("#curPage").val();
				var actionUrl =  "${ctx }/security/user!changeState_customer.do?userId="+id+"&curPage="+curPage+"&operateStr="+status;

				window.location.href = actionUrl ;
			}
		}else{
			var curPage = $("#curPage").val();
			var actionUrl =  "${ctx }/security/user!changeState_customer.do?userId="+id+"&curPage="+curPage+"&operateStr="+status;

			window.location.href = actionUrl ;
		}
	}

	$(function(){
		$("a[name='addressHref']").click(function(){
			var id = $(this).attr("title");
			var view_url = "${ctx}/security/user!listAddressOfCustomer.do?id="+id+"&"+new Date().getTime();

			art.dialog({
			    content: document.getElementById("address_list_div"),
			    title:'收货地址列表'
		    });
		    
			$.ajax( {
				type : "GET",
				url : view_url,
				timeout : 6000,
				async : true, //ajax同步
				success : function(data, textStatus) {
					var items = eval("("+data+")");
					var htmlStr = "";
					var len  = items.length;
					if(len > 0 ){
						for(var i = 0 ;i < len;i++){
							var provinceInfo = items[i].provinceInfo;
							var cityInfo = items[i].cityInfo;
							var address = items[i].address;
							var mobile = items[i].mobile;
							var consignee = items[i].consignee;
							htmlStr +='<tr><td width="100" height="35" align="center">地址'+(i+1)+'：</td><td style="padding-left:20px;">'+provinceInfo+cityInfo+address+'&nbsp;&nbsp;手机号：'+mobile+'&nbsp;&nbsp;收货人：'+consignee+'</td></tr>';
						}
					}
					else{
						htmlStr = '<tr><td height="35" align="center">无收货地址</td></tr>';
					}
					$("#tbody_address_list").html(htmlStr);
				}
			});
	    });

		m2('m1_008','m1_008_03');
	});

</script>
</head>
<body>

<jsp:include page="/commons/head_member.jsp"></jsp:include>

	<form action="${ctx }/security/user!listCustomer.do" method="post" id="customer_list_form" name="customer_list_form">
		<div style="border: 1px solid #ccc;margin:0 auto;background: #fff;padding-top: 10px;width: 960px;">
		   <table width="900" border="0" cellspacing="0" cellpadding="0" align="center" style="margin: 0 auto;">
		            <tr>
		              <td  colspan="100%" style="padding-left: 10px;padding-top:10px;font-family: 宋体;font-size: 12px;">开始时间： <input name="startDate" type="text" size="15" onClick="WdatePicker()" value="<fmt:formatDate value='${startDate }' pattern='yyyy-MM-dd'/>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		              		结束时间： <input name="endDate" type="text" size="15" onClick="WdatePicker()"  value="<fmt:formatDate value='${endDate }' pattern='yyyy-MM-dd'/>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		       				会  员：  <input name="filterTxt" value="userName" type="hidden"/>
							<input name="filterValue" type="text" size="15" value="${filterValue }"/>
		                  <img src="../images/an25.gif" width="50" height="21" style="cursor: pointer;vertical-align: middle;" onclick="searchMember();">
		                </td>
		            </tr>
		            <tr><td height="10"></td></tr>
		            <tr>
		              <td colspan="100%"><table width="100%" class="tbl" cellpadding="0" cellspacing="0" align="center">
		                  <tr bgcolor="#CDE1ED">
		                    <td height="35">会员姓名</td>
		                    <td>手机号</td>
		                    <td>注册时间</td>
		                    <td>审核状态</td>
		                    <td>审核/编辑</td>
		                    </tr>
		                <c:forEach items="${page.result}" var="customerInfo" varStatus="status">
		                  <tr bgcolor="#FFFFFF">
		                    <td height="30">${customerInfo.userName }</td>
		                    <td>${customerInfo.userName }</td>
		                    <td><fmt:formatDate value='${customerInfo.registerTime }' pattern='yyyy-MM-dd HH:mm:ss'/></td>
		                    <td>${customerInfo.userState.name }</td>
		                    <td>
			                     <a style="color: blue;cursor: pointer" href="javascript:changeState(${customerInfo.id },'1')">通过</a>&nbsp;
			                     <a style="color: blue;cursor: pointer" href="javascript:changeState(${customerInfo.id },'2')">不通过</a>&nbsp;
			                     <a name="addressHref" style="color: blue;cursor: pointer" title="${customerInfo.id }">收货地址</a>&nbsp;
			                     <a style="color: blue;cursor: pointer" href="javascript:changeState(${customerInfo.id },'3')">删除</a>
		                     </td>
		                    </tr>
		                 </c:forEach>
		              </table></td>
		            </tr>
		           <tr>
						<td colspan="100%" class="nw12a">
							<div align="right"><jsp:include page="/commons/paging_footer.jsp"/></div>
						</td>
				  </tr>
		  </table>
		</div>
	</form>

<div id="address_list_div" style="display: none;">
	<table width="700" border="0" align="center" style="margin-top: 10px;font-size: 12px;" class="tbl_detail">
           <tbody id="tbody_address_list"></tbody>
	 </table>
</div>

<jsp:include page="/commons/foot.jsp"></jsp:include>

</body>
</html>